package com.dl.exam.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Page<T> implements Serializable {
    //页码
    private Integer currentPage;
    //页面大小
    private Integer pageSize;
    //数据总数
    private Integer total;
    //页面总数
    private Integer totalPage;
    //当前页面数据集合
    private List<T> list;


/*    //当我们调用 数据总数的set和页面大小的set后，自动计算出总页数
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
        this.totalPage = this.total % this.pageSize == 0 ? this.total / this.pageSize : this.total / this.pageSize + 1;
    }*/

}
